<div class="Main_left" id="Main_left">
      <div class="Main_shortcutsBar" id="LeftSide">
        <div class="Main_shortcutsBar_head"><span><@s.text name="i18n.project.title"/></span></div>
        <div class="Main_shortcutsBar_body">
          <div id="MenuBox"></div>
        </div>
        <div class="Main_shortcutsBar_foot"></div>
      </div>
      <div class="Main_switchBar">
	 	 <div class="arrowLeft" onclick="switchMainLeft(this);"></div>
	  </div>
    </div>
	

<script anguage="javascript">
var crtMainMenu = "headerNavBar02";
var category = [
 		{id:"mainmenu1",text:"",	href:"javascript:void(0)"},
		{id:1,				level:1,text:"",	remark:"",	type:"root"},
		{id:4,	parent:1,	level:2,text:"新建任务",	remark:"新建任务",	type:"branch" ,parentlink:"1" ,href:"${base}/task/toadd.action"},
		<#if action.hasPermission(2)>
		{id:2,	parent:1,	level:2,text:"任务列表",	remark:"任务列表",	type:"branch" ,parentlink:"1" ,href:"${base}/task/list.action"},
		</#if>
		{id:3,	parent:1,	level:2,text:"我的任务",	remark:"我的任务",	type:"branch" ,parentlink:"1" ,href:"${base}/mytask/list.action"}<#if action.hasPermission(3)>,
		
		{id:5,	parent:1,	level:2,text:"用户管理",	remark:"用户管理",	type:"branch" ,parentlink:"1" ,href:"${base}/user/userlist.action"},
		
		{id:6,	parent:1,	level:2,text:"用户组管理",	remark:"用户组管理",	type:"branch" ,parentlink:"1" ,href:"${base}/usergroup/grouplist.action"}
		</#if>
		<#--,
		{id:3,	parent:1,	level:2,text:"任务统计",	remark:"任务统计",	type:"branch" ,parentlink:"1" ,href:"${base}/task/count.action"} -->
	]

function selectNode(event){
	var obj = $("MenuBox").getElementsByTagName("div");
	var a	= $("MenuBox").getElementsByTagName("a");

	var e = window.event || event;

	var target = $(Event.element(e).id);
	crtselect = target.id;
	crtlevel = target.getAttribute("level");

	for(var j=0;j<a.length;j++)
	{
		if(a[j].getAttribute("level")==crtlevel &&a[j].id!=crtselect){
			$(a[j].id + "_subarea").style.display = "none";
			$(a[j].id).parentNode.className = $(a[j].id).parentNode.getAttribute("nclass");
		}
	}
}


var crtselect="root";

var crtlevel = 1;
var maxlevel = 4;


function addnode(){
	if(crtlevel>= maxlevel)
		return;
	if(!crtselect)
		return;
	var arg = new Object();
	arg.id = "node" + inc;
	arg.parent = $(crtselect + "_subarea");
	arg.text = $("txtCategoryName").value;
	arg.remark = $("txtCategoryRemark").value;
	arg.level = parseInt(crtlevel)+1;

	if(arg.type == "branch"){
		arg.item_normal="item_normal";
		arg.item_select="item_select";
	}else{
		arg.item_normal="leaf_item_normal";
		arg.item_select="leaf_item_select";
	}
	var newnode = new TreeNode(arg);
	newnode._itemHandler = function(event){selectNode(event)};
	inc ++;
}

function addCategorys(arr){
	var arr1 = [];
	var arr2 = [];
	var arr3 = [];

	for(var i=0;i<arr.length;i++){
		if(arr[i].type=="root"){
			arr1.push(arr[i]);
		}
		else if(arr[i].type=="branch"){
			arr2.push(arr[i]);
		}else if(arr[i].type=="leaf"){
			arr3.push(arr[i]);
		}
	}
	addByType(arr1,"root");
	addByType(arr2,"branch");
	addByType(arr3,"leaf");

}
function addByType(arr,type){
	for(var i=0;i<arr.length;i++){
		if(type=="root"){
			var nd = new TreeNode({id:arr[i].id,parent:$("MenuBox"),text:arr[i].text,href:arr[i].href,remark:arr[i].remark,parentlink:arr[i].parentlink,level:1,indent:0,item_normal:"root_normal",item_select:"root_select"})
			nd._itemHandler = function(event){selectNode(event);};
			nd._itemHandler2 = function(event){setHeight('Main_body','Main_left');}
		}
		else if(type=="branch"){
			var item_n,item_s;
			item_n = arr[i].level>2?"sub_item_normal":"item_normal";
			item_s = arr[i].level>2?"sub_item_select":"item_select";
			var nd = new TreeNode({id:arr[i].id,parent:$(arr[i].parent + "_subarea"),text:arr[i].text,href:arr[i].href,remark:arr[i].remark,parentlink:arr[i].parentlink,level:arr[i].level,item_normal:item_n,item_select:item_s})
			nd._itemHandler = function(event){selectNode(event);};
			nd._itemHandler2 = function(event){setHeight('Main_body','Main_left');}
		}
		else if(type=="leaf") {
			var nd = null;
			if(arr[i].level == 4)
				nd = new TreeNode({id:arr[i].id,parent:$(arr[i].parent + "_subarea"),text:arr[i].text,href:arr[i].href,remark:arr[i].remark,parentlink:arr[i].parentlink,level:arr[i].level,item_normal:"menu_item_normal4",item_select:"menu_item_select4"})
			else
				nd = new TreeNode({id:arr[i].id,parent:$(arr[i].parent + "_subarea"),text:arr[i].text,href:arr[i].href,remark:arr[i].remark,parentlink:arr[i].parentlink,level:arr[i].level,item_normal:"leaf_item_normal",item_select:"leaf_item_select"})
			nd._itemHandler = function(event){selectNode(event);};
			nd._itemHandler2 = function(event){setHeight('Main_body','Main_left');}
		}
	}
}

</script>	